﻿namespace FlowControl
{
    class FlowCheckUpdate : FlowBase
    {
        public override void Activate()
        {
            base.Activate();
            ZEventCenter.AddEventListener(ConstData.FLOW_CHECK_UPDATE, OnComplete);
            LoadBoardMgr.GetSingleton().SetDescri(GlobalString.checkUpdate);
            LoadBoardMgr.GetSingleton().Show();
            ABCheckUpdate.GetSingleton().Start();
        }

        public override void FlowUpdate(float duringTime)
        {
            base.FlowUpdate(duringTime);
            LoadBoardMgr.GetSingleton().SetPercent(ABCheckUpdate.GetSingleton().LoadProgress);
        }
        
        private void OnComplete(ZEvent ev)
        {
            ZEventCenter.RemoveEventListener(ConstData.FLOW_CHECK_UPDATE, OnComplete);
            IsComplete = true; LoadBoardMgr.GetSingleton().Close();
        }
    }
}